home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8847 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.0 KB

  1. Path: ibm32.perftech.com!usenet
  2. From: murf@perftech.com (John Murphy)
  3. Newsgroups: comp.lang.c++,comp.os.msdos.programmer
  4. Subject: Re: Timer (0x1C) Interrupt exactly 18.2 seconds?
  5. Date: 26 Feb 1996 23:48:00 GMT
  6. Organization: Performance Technology Inc
  7. Message-ID: <4gtgrg$k20@ibm32.perftech.com>
  8. References: <4givrv$cim@midland.co.nz> <Dn9FMB.19s.0.sheppard@torfree.net> <448372328wnr@fatphil.demon.co.uk>
  9. NNTP-Posting-Host: k5zba.perftech.com
  10. Mime-Version: 1.0
  11. NNTP-Posting-User: REVCO
  12. X-Newsreader: WinVN 0.93.11
  13.  
  14. In article <448372328wnr@fatphil.demon.co.uk>, Phil@fatphil.demon.co.uk 
  15. says...
  16. >
  17. >In article: <Dn9FMB.19s.0.sheppard@torfree.net>  ak892@torfree.net (Bruce 
  18. DeVisser) writes:
  19. >> 
  20. >> Jarrod S Lowe (lowefam@igrin.co.nz) wrote:
  21. >> : Hi
  22. >> 
  23. >> : I have a C++ Program (on DOS) in which a function is attached to the
  24. >> : Timer (0x1C) Interrupt.
  25. >> 
  26. >> : [snip]
  27. >> 
  28. >> : This program is expected to run, continually, for YEARS - so a drift
  29. >> : that shows up in 5 minutes will make it unusable.
  30. >> 
  31. >> : Does anybody have any ideas WHY this is happening?
  32. >> 
  33. >> Yes; because the timer is not exactly 18.2 Hz. Try taking the oscillator 
  34. >> frequency -- 1.19318 MHz (which may drift slightly, so don't get too 
  35. >> carried away with precision), dividing it by 65536, and see what you come 
  36. >> up with.
  37. >> 
  38. >>    Bruce DeVisser
  39. >
  40. >This comes from the asm.x86 group, where we've just had a similar 
  41. >discussion
  42. >
  43. >
  44. >In article: <3124955A.2EF1@hda.hydro.com>  Terje Mathisen 
  45. ><Terje.Mathisen@hda.hydro.com> writes:
  46. >> Here's another way to translate the 18.206...Hz ticks into 
  47. >> seconds: Multiply the ticks by the ratio 1913/34829 = 
  48. >> 18.20648196.
  49. >> 
  50. >> This is the closest possible 16-bit only rational approximation 
  51. >> to the true value, it is probably more accurate than the clock 
  52. >> frequency of most PCs, so there's no need to try to improve upon 
  53. >> it.
  54. >
  55. >Sorry Terje, 
  56. >I beg to differ in the 8th significant digit!! 
  57. [snip]
  58. Just as a point of interest, the ratio used internally by DOS is 
  59. 298295/16384.
  60.  
  61. Murf
  62.  
  63.